﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace EbnfStudio.Controls
{
    /// <summary>
    /// A panel containing the image
    /// </summary>
    class ImagePanel : ScrollableControl
    {

        /// <summary>
        /// the picture box control
        /// </summary>
        PictureBox m_pictureBox;
        

        /// <summary>
        /// Set the bitmap image. Takes the ownership!
        /// </summary>
        public Bitmap Image
        {
            set
            {
                m_pictureBox.ClientSize = new Size(
                    value.Width, value.Height
                );
                m_pictureBox.Image = value;
            }
        }


        /// <summary>
        /// contructor for the image panel
        /// </summary>
        public ImagePanel() : base()
        {
            m_pictureBox = new PictureBox();
            this.Controls.Add(m_pictureBox);
            this.AutoScroll = true;
            this.Dock = DockStyle.Fill;
        }
    }
}
